//
//  UIView+Extension.swift
//  weiBo
//
//  Created by 杨雷 on 2016/11/30.
//  Copyright © 2016年 Yang.L. All rights reserved.
//

import UIKit

extension UIView {
    
    //获取x和y坐标 并设置
    var x: CGFloat {
        get {
            return self.frame.origin.x
        }
        set {
            self.frame.origin.x = newValue
        }
    }
    
    var y: CGFloat {
        get {
            return self.frame.origin.y
        }
        set {
            self.frame.origin.y = newValue
        }
    }
    
    //获取宽和高 并设置
    var width: CGFloat {
        get {
            return self.frame.size.width
        }
        set {
            self.frame.size.width = newValue
        }
    }
    
    var height: CGFloat {
        get {
            return self.frame.size.height
        }
        set {
            self.frame.size.height = newValue
        }
    }
    
    //获取size 并设置
    var size: CGSize {
        get {
            return self.frame.size
        }
        set {
            self.frame.size = newValue
        }
    }
    
    //获取center 并设置
    var centerX: CGFloat {
        get {
            return self.centerX
        }
        set {
            self.centerX = newValue
        }
    }
    
    var centerY: CGFloat {
        get {
            return self.centerY
        }
        set {
            self.centerY = newValue
        }
    }
    
    
    
    
    
    
}






